//apis
import { getThemeSettings } from '../apis/index'
// utils
import { isXcx } from '@kukefe/kkutils'
export const useThemeEffect = async () => {
  /**
   * @description 获取主题色
   */
  const getTheme = async () => {
    // 只处理两种场景 不是小程序就是wap
    const { data } = await getThemeSettings({
      productSide: isXcx() ? 5 : 7
    })
    if (data.wholeStationEssentialColour === 1) {
      document.documentElement.style.setProperty('--kc-system-theme-color', data.wholeStationColour)
    } else {
      document.documentElement.style.setProperty(
        '--kc-system-theme-color',
        data.wholeStationColourCustom
      )
    }
  }

  await getTheme()
}
